﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace dotNetTraining.Service
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service1" in both code and config file together.
    public class Service1 : IService1,IProduct
    {
        public string GetData(int value)
        {
            return string.Format("You entered: {0}", value);
        }

        public CompositeType GetDataUsingDataContract(CompositeType composite)
        {
            if (composite == null)
            {
                throw new ArgumentNullException("composite");
            }
            if (composite.BoolValue)
            {
                composite.StringValue += "Suffix";
            }
            return composite;
        }


        public List<Product> LProducts()
        {
            return new List<Product>()
                    {
                        new Product(){
                            Id=1,
                            Name="P01",
                            Price=120000,
                            Description="New product 1"
                        },
                        new Product(){
                            Id=2,
                            Name="P02",
                            Price=120000,
                            Description="New product 2"
                        },
                        new Product(){
                            Id=3,
                            Name="P03",
                            Price=120000,
                            Description="New product 3"
                        },
                        new Product(){
                            Id=4,
                            Name="P04",
                            Price=120000,
                            Description="New product 4"
                        }
                    };
        }

        public int PriceToDay()
        {
            return 100;
        }
    }
}
